The present invention relates to image rendering, and more particularly to improving sample test efficiency in image rendering applications.
The rendering of a high quality image relies upon an accurate color computation for each pixel forming the image. The accuracy of this color computation is improved by distributing sample points across each pixel, testing which sample points are overlapped by a primitive which is to be rendered in the image, and computing a color for the pixel based upon those overlapped and non-overlapped sample points.
Sample testing algorithms (sometimes referred to as “point in polygon tests”) determine which samples of a screen space region (usually a pixel) are overlapped by a primitive, and the quality of such algorithms can be based upon their “sample test efficiency” (STE), this term referring to the number of sample points overlapped by a primitive versus the number of sample points tested for a given screen space region, e.g. a pixel. A high STE indicates an efficient sample testing algorithm, as a high percentage of the test sample points were actually or possibly overlapped by the primitive.
Techniques for improving STE are useful in the contexts of motion blur and depth of field rendering effects, as both types of effects involve a primitive potentially traversing a large number of pixels, resulting in a potentially large number of sample points which have to be considered for testing.
Motion blur results when the camera and/or geometry move while the virtual camera shutter is open. While the motion can theoretically be arbitrary during the exposure of a frame, it has been observed in film industry that vertex motion can often be satisfactorily simplified by assuming linear motion between shutter open (t=0) and closed (t=1).
In stochastic rasterization, the frame buffer is generalized so that each sample has additional properties in addition to the screen-space (x, y) position. In order to support motion blur, a time value is assigned to each frame buffer sample. In absence of motion, the frame buffer behaves exactly as it does currently, providing spatial antialiasing. With motion, a sample is updated only when a triangle overlaps the sample at the time of the sample.
The prior art describes several ways of interpolating a triangle to a specified time. One approach is as described in “The Accumulation Buffer: Hardware Support for High Quality Rendering,” P. Haberli and K. Akeley, Proc. SIGGRAPH 1990, pgs. 309-318, and in “Data-Parallel Rasterization of Micropolygons with Defocus and Motion Blur,” K. Fatahalian, E. Luong, S. Boulos, K. Akeley, W. Mark, and P. Hanrahan, Proc. High Performance Graphics 2009. This approach involves interpolating the vertices of a primitive in homogeneous clip space before triangle setup, and therefore a separate triangle setup/rendering pass is required for each distinct time. While simple to implement, this approach may not scale to a large number of samples per pixel, and the image quality can suffer due to a fixed (typically small) set of unique time values.
A second conventional approach has been to identify the screen-space bounds for the “time-continuous triangle” (TCT) for the entire exposure time, and then test all samples in all covered pixels by interpolating the triangle to the current sample's time, as described in disclosed in “Stochastic rasterization using time-continuous triangles,” T. Akenine-Möller, J. Munkberg, and J. Hasselgren, Proc. Graphics Hardware 2009. Possible implementations include at least time-continuous edge functions (about 3× the cost of traditional 2D edges) and ray-triangle intersection. TCTs offer high image quality because a unique time value can be set to each sample, but an accompanying disadvantage is low STE. When a triangle moves quickly, it can cover a relatively large region on the screen, yet at the same time we expect it to cover approximately a constant number of samples regardless of motion. STE therefore degrades drastically for fast motion, and can be as low as 1% in realistic cases.
A third approach is described in U.S. Pat. No. 4,897,806, whereby exposure time is split into several strata (typically, the number of strata equals the number of samples per pixel), and the above-mentioned second approach is called for each strata. This improves STE significantly, but the efficiency of the solution is not optimal for the low sampling densities typically encountered in fast rendering graphics (4-16 samples/pixel).
Another challenge in the rendering of images is how to process primitives which reach behind the camera plane. A possible approach for dealing with such primitives is to clip the primitive in time, producing a number of sub-spans where clipping edges are replaced by clip vertices that move across the camera plane. Unfortunately, the motion of the clip vertices is not screen-space affine, so an approximation is required for their motion, which makes it difficult if not impossible to match a reference rendering.
An additional challenge in the rendering of images is the rendering of vertices which move affinely in world space. When the vertices move affinely in world space, which is a common approximation, the resulting screen-space motion is not linear because of perspective transformation. Therefore, if linear screen-space motion was assumed, the motion-blurred image would not correspond to ground truth rendering that would be obtained by summing together a large number of images obtained at regularly spaced time instants during the frame. The difference is usually small, but when there is motion towards or away from the viewer near the camera, the results are clearly different.
An even further challenge is the retention of a high STE in circumstances in which both motion and defocus blur occur simultaneously.
In view of the shortcomings of the conventional approaches, a new method for providing improved sample test efficiency in image rendering is needed.